<!-- 采购--销售--库存 列表 -->
<template>
	<view class="common_out">
		<view class="common_out_list" v-for="(val,total) in rundata" @click="details_list(val)">
			<div class="common_left">
				<view v-if="deliverType == 2">
					<div  class="common_list" >
						<view class="common_list_name">单据编号：</view>
						<view class="common_list_neir">{{val['voucherCode']}}</view>
					</div>
				</view> 
				
				<view class="common_list" v-for="(item,index) in titleList" v-if="item.code != 'voucherType'">
					<view class="common_list_name">{{item.name}}:</view>
					
					<view class="common_list_neir" v-if="item.code == 'businessType'">
						{{
							val[item.code] == 4 ? '领料' : 
							val[item.code] == 5 ? '退料' : 
							val[item.code] == 6 ? '超领' : 
							val[item.code] == 7 ? '零星' : ''
						}}
					</view>
					<view class="common_list_neir" v-else>
						{{item.code.substr(-2,3) == 'Id' ? val[item.code.replace('Id',"Name")] : val[item.code]}}
					</view>
				</view>
				
				<view class="common_list" v-for="(item,index) in deliverList"
					v-if="item.code =='no' || item.code == 'voucherDate' ">
					<view class="common_list_name">{{item.name}}:</view>
					<view class="common_list_neir">{{item.code == 'no'?val['voucherCode']: val[item.code]}}</view>
				</view>	
				
				
				<view v-if="deliverType == 1">
					<div  class="common_list" >
						<view class="common_list_name">业务员：</view>
						<view class="common_list_neir">{{val['salesmanName']}}</view>
					</div>
					<div  class="common_list" >
						<view class="common_list_name">审核人：</view>
						<view class="common_list_neir">{{val['reviewerUserName']}}</view>
					</div>
					<div  class="common_list" >
						<view class="common_list_name">审核时间：</view>
						<view class="common_list_neir">{{val['reviewerDate']}}</view>
					</div>
					<div  class="common_list" >
						<view class="common_list_name">库管员：</view>
						<view class="common_list_neir">{{val['inUserName']}}</view>
					</div>
				</view> 
				<view v-if="deliverType == 2">
					<div  class="common_list" >
						<view class="common_list_name">库管员：</view>
						<view class="common_list_neir">{{val['inUserName']}}</view>
					</div>
				</view> 
				
				
			</div>
			<div class="common_right">
				<div class="common_type">
					{{
						val.voucherState == 0 ? '待审核' : 
						val.voucherState == 1 ? '已审核' : 
						val.voucherState == -1 ? '待提交' : 
						val.voucherState == 10 ? '已关闭' :
						val.voucherState == 2 ? val.receiveDeliverType == '1' ? '已入库' : "已出库" : ''
					}}
				</div>
			</div>
		</view>
		<div class="null_title" v-if="rundata == ''">
			<div>
				<i class="iconfont icon-empty iconcize"></i>
			</div>
			<div class="null_title_tow">
				没有更多数据
			</div>
		</div>
	</view>
</template>


<script>

	export default {
		props: {
			rundata: {
				default: ''
			},
			titleList: {
				default: Array
			},
			deliverType: {  // 1，销售出库单，2，采购入库单
				default: 0,
			},
			deliverList: {
				default: Array
			},
			curl_data: {
				default: ''
			},
			CurlOption: {
				default: ''
			}
		},
		data() {
			return {
				dataSorce: '',
				Url_str: '',
			}
		},
		mounted() {

			this.Url_str = "&title=" + this.CurlOption.title + "&sort=" + this.CurlOption.sort + "&key=" + this.CurlOption
				.key + "&c_code=" + this.CurlOption.c_code + "&search_code=" + this.CurlOption.search_code;
				
				
		},
		methods: {
			details_list(val) {
				uni.navigateTo({
					url: "/pages/common/index/purchase/library/library-details?id=" + val.id + '&code=' + this
						.curl_data.code + this.Url_str
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.common_out {
		width: 95%;
		margin: auto;
	}
	
	.common_out_list {
		padding: 10px 0 10px 30rpx;
		border-radius: 4px;
		margin-bottom: 10px;
		background-color: #fff;
		box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
		display: flex;
	}

	.common_list {
		display: flex;
		height: 40rpx;
		line-height: 40rpx;
	}

	.common_list_name {
		width: 25%;
		text-align: left;
		overflow: hidden;
	}

	.common_list_neir {
		padding: 0 0 0 20rpx;
		overflow: hidden;
	}

	.common_left {
		width: 100%;
	}

	.common_type {
		position: absolute;
		margin-top: 2%;
		right: 10%;
		padding: 1px 20rpx 1px 20rpx;
		background-color: #0098EF;
		color: #fff;
		border-radius: 4px;
		text-align: center;
		box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
	}
</style>
